home *** CD-ROM | disk | FTP | other *** search
/ What Lies Beneath Press Kit / What Lies Beneath Press Kit.iso / pc / What Lies Beneath.dxr / Scripts_20_Text Select-Toggle Button.ls < prev    next >
Encoding:
Text File  |  2000-06-22  |  4.4 KB  |  145 lines

  1. property pTextName, pWhatChanges, pWhatShows, pDestination, pTemp, pGroupName, pInitialState, pNumStates, pComplexString, ancestor
  2. global gCurrentText, gDownloadTexts
  3.  
  4. on beginSprite me
  5.   pTemp = "temp"
  6.   previousItemDelimiter = the itemDelimiter
  7.   the itemDelimiter = "."
  8.   pTextName = item 1 of the name of the member of sprite the spriteNum of me
  9.   the itemDelimiter = previousItemDelimiter
  10.   if pWhatShows = #gCurrentTextStatus then
  11.     if pInitialState = #on then
  12.       gCurrentText = pTextName
  13.       sendAllSprites(#UpdateDetail, #text)
  14.     end if
  15.   else
  16.     if pWhatShows = #selectedToDownLoadStatus then
  17.       if pTextName = "gCurrent" then
  18.         if getPos(gDownloadTexts, gCurrentText) then
  19.           pInitialState = #on
  20.         else
  21.           pInitialState = #off
  22.         end if
  23.       else
  24.         if getPos(gDownloadTexts, pTextName) then
  25.           pInitialState = #on
  26.         else
  27.           pInitialState = #off
  28.         end if
  29.       end if
  30.     end if
  31.   end if
  32.   if pNumStates = #complex then
  33.     pNumStates = value(pComplexString)
  34.   end if
  35.   numTrans = pNumStates
  36.   if pWhatShows = #nothing then
  37.     togSty = 0
  38.   else
  39.     togSty = 1
  40.   end if
  41.   selfTog = pWhatChanges = pWhatShows
  42.   togGrup = pGroupName
  43.   togState = pInitialState
  44.   if pWhatShows = #gCurrentTextStatus then
  45.     togOffbl = 0
  46.   else
  47.     if pWhatShows = #selectedToDownLoadStatus then
  48.       togOffbl = 1
  49.     end if
  50.   end if
  51.   if pWhatChanges = #gCurrentTextStatus then
  52.     togOnOthOff = 1
  53.   else
  54.     togOnOthOff = 0
  55.   end if
  56.   ancestor = new(script("Bitmap But 1"), me.spriteNum, numTrans, togSty, togGrup, togState, togOffbl, selfTog, togOnOthOff)
  57.   UpdateWhatItShows(me)
  58. end
  59.  
  60. on MouseUpAction me
  61.   if pWhatChanges = #gCurrentTextStatus then
  62.     gCurrentText = pTextName
  63.     sendAllSprites(#UpdateDetail, #text)
  64.     sendAllSprites(#UpdateWhatItShows)
  65.   else
  66.     if pWhatChanges = #selectedToDownLoadStatus then
  67.       if pTextName = "gCurrent" then
  68.         if not getPos(gDownloadTexts, gCurrentText) then
  69.           append(gDownloadTexts, gCurrentText)
  70.         else
  71.           deleteAt(gDownloadTexts, getPos(gDownloadTexts, gCurrentText))
  72.         end if
  73.       else
  74.         if not getPos(gDownloadTexts, pTextName) then
  75.           append(gDownloadTexts, pTextName)
  76.         else
  77.           deleteAt(gDownloadTexts, getPos(gDownloadTexts, pTextName))
  78.         end if
  79.       end if
  80.     end if
  81.   end if
  82.   if pDestination <> EMPTY then
  83.     go(pDestination)
  84.   end if
  85. end
  86.  
  87. on MouseDownAction me
  88.   nothing()
  89. end
  90.  
  91. on MouseEnterAction me
  92.   nothing()
  93. end
  94.  
  95. on MouseLeaveAction me
  96.   nothing()
  97. end
  98.  
  99. on UpdateWhatItShows me
  100.   if pWhatShows = #selectedToDownLoadStatus then
  101.     if pTextName = "gCurrent" then
  102.       if getPos(gDownloadTexts, gCurrentText) then
  103.         state = #on
  104.       else
  105.         state = #off
  106.       end if
  107.     else
  108.       if getPos(gDownloadTexts, pTextName) then
  109.         state = #on
  110.       else
  111.         state = #off
  112.       end if
  113.     end if
  114.     if not (state = me.pToggleState) then
  115.       me.pToggleState = state
  116.       setstate(me, me.pCurrentState)
  117.     end if
  118.   end if
  119. end
  120.  
  121. on getPropertyDescriptionList me
  122.   description = [:]
  123.   addProp(description, #pInitialState, [#default: #off, #format: #symbol, #comment: "Initial State", #range: [#off, #on]])
  124.   addProp(description, #pWhatChanges, [#default: #gCurrentTextStatus, #format: #symbol, #comment: "What It Changes", #range: [#nothing, #gCurrentTextStatus, #selectedToDownLoadStatus]])
  125.   addProp(description, #pWhatShows, [#default: #gCurrentTextStatus, #format: #symbol, #comment: "What It Shows", #range: [#nothing, #gCurrentTextStatus, #selectedToDownLoadStatus]])
  126.   addProp(description, #pGroupName, [#default: "TextButtons", #format: #string, #comment: "Toggle Group Name"])
  127.   addProp(description, #pDestination, [#default: EMPTY, #format: #string, #comment: "Frame Destination"])
  128.   addProp(description, #pNumStates, [#default: 3, #format: #symbol, #comment: "Number of States", #range: [2, 3, 4, 5, 6, #complex]])
  129.   addProp(description, #pComplexString, [#default: "[[1,0],[1,0],[1,0],[#m,0],[#m,0],[#m,0]]", #format: #string, #comment: "Complex Array"])
  130.   return description
  131. end
  132.  
  133. on getBehaviorDescription me
  134.   endChar = offset("--END OF HEADER", me.text)
  135.   endLine = the number of lines in char 1 to endChar of the text of me - 1
  136.   description = line 1 to endLine of the text of me
  137.   repeat with whichLine = endLine down to 1
  138.     if line whichLine of description = EMPTY then
  139.       delete line whichLine of description
  140.     end if
  141.   end repeat
  142.   delete line 1 of description
  143.   return description
  144. end
  145.